 //1.导入模块
import Vue from "vue"

import { createRouter,createWebHashHistory } from 'vue-router'
//2.导入组件



import boot from "../components/boot"
import admin_login from "@/components/boot/admin_login"
import img from "@/components/boot/img"



//3.定义路由字典
var routes = [
    {
        path:"/admin_login",
        component:admin_login
    },
    {
        path:"/",
        redirect :"/admin_login"
    },
   
    {
        path:"/boot",
        component:boot,
        children:[
            {
                path:"/goods",
                name:"goods",
                component:() =>
                import("../components/boot/goods")
            },
            {
                path:"/users",
                name:"users",
                component:() =>
                import("../components/boot/users")
            },
            {
                path:"/admin",
                name:"admin",
                component:() =>
                import("../components/boot/admin")
            },
            {
                path:"/like",
                name:"like",
                component:() =>
                import("../components/boot/like")
            },
            {
                path:"/recommend",
                name:"recommend",
                component:() =>
                import("../components/boot/recommend")
            },
            {
                path:"/seckill",
                name:"seckill",
                component:() =>
                import("../components/boot/seckill")
            },
            {
                path:"/parment",
                name:"parment",
                component:() =>
                import("../components/boot/parment")
            },
            {
                path:"/home",
                name:"home",
                component:() =>
                import("../components/boot/home")
            },
             {
                path:"/success",
                name:"success",
                component:() =>
                import("../components/boot/success")
            }
            
        ]
    },
    {
        path:"/img",
        component:img,
        name:img
    }
]
//5.创建路由对象，将路由字典封装
const router = createRouter({
    history: createWebHashHistory(),
    routes,
    })

//全局路由守卫 router.beforeEach  .before

//6.导出路由对象
export default router;